Skip to content

fix(#301): 身份改用请求头注入,修复流程列表 500 - #88

Merged
xlorne merged 1 commit into
devfrom
feature/issue-301-identity-header
Dec 3, 2026
Merged

xlorne merged 1 commit into
devfrom
feature/issue-301-identity-header

Conversation

@xlorne

@xlorne xlorne commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

关联 issue

codingapi/flow-engine#301

问题

app-pc / app-mobile 把当前身份作为 query 参数 operatorIdentity 注入所有 /api/ 请求(issue #288 引入)。后端的流程列表接口用 SearchRequest 接收请求,会把 query 参数当作实体过滤字段解析,多一个 operatorIdentity 就报:

Field operatorIdentity not found in class hierarchy.

流程列表页 500。

修复

  • flow-core 新增 HttpClient.defaultHeaders 与 mergeDefaultHeaders:
    • undefined / null 的键跳过(本次不携带);
    • 空串保留,用于表达「显式选择默认身份」与「未携带该头」的区别;
    • 不修改入参,与 Authorization 等已有请求头合并;
  • apps/app-pc、apps/app-mobile 改为 X-Operator-Identity 请求头注入,不再写入 query;
  • 补充 mergeDefaultHeaders 单测(6 例)。

验证

  • rstest:flow-core 20 用例全绿(http 相关 12 例,含新增 6 例);
  • rslib build(含 d.ts)通过:flow-core / flow-types / flow-icons / flow-approval-presenter / flow-pc-ui / flow-pc-form / flow-pc-approval / flow-design;
  • 后端侧配合验证见 fix(#301): 身份改为请求头传递,修复流程列表 500 flow-engine#302:query 方式复现 500,请求头方式返回 success:true。

说明:apps/app-pc 的 rsbuild build 在 worktree 中因各包 dist 只有 d.ts、缺少同名 .js(rslib build 的产物形态)而无法完成打包,属于依赖产物问题,与本次改动无关;改动本身仅涉及 flow-core 的新 API 与两处 defaultHeaders 赋值。

依赖

需先合并 codingapi/flow-engine#302(服务端支持请求头读取)。服务端保留了 query 兼容,因此本 PR 单独合并也不会导致旧逻辑失效。

身份原先前端以 query 参数 operatorIdentity 注入所有 /api/ 请求,后端的
SearchRequest 列表接口会把 query 参数当作实体过滤字段解析,导致
Field operatorIdentity not found in class hierarchy,流程列表直接 500。

- flow-core 新增 HttpClient.defaultHeaders 与 mergeDefaultHeaders
  (undefined 跳过、空串保留以表达「显式默认身份」)
- app-pc / app-mobile 身份改为 X-Operator-Identity 请求头,不再写入 query
- 补充 mergeDefaultHeaders 单测

Refs codingapi/flow-engine#301
@xlorne
xlorne merged commit 69621f7 into dev Dec 3, 2026
1 check passed
@xlorne
xlorne deleted the feature/issue-301-identity-header branch December 3, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant